package cn.edu.nit.sys.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

/**
 * @Author xiaobai
 * @Date 2022/11/19 20:16
 * @Version 1.0.0
 */
@Data
@TableName("sys_equip")
public class Room {

    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    private String name;
    private String position;
    private Integer volume;
    private Integer stateId;
    private String stateName;
    @JsonSerialize(using = ToStringSerializer.class)
    private Long author;
    private String description;
    private String createTime;
    @JsonSerialize(using = ToStringSerializer.class)
    @TableField(exist = false)
    private Long eid;
    @TableField(exist = false)
    private String ename;
    @TableField(exist = false)
    private String ephone;

    public String getStateName() {
        if("0".equals(stateId)) {
            return "关闭";
        }
        return "开放";
    }
}
